package com.macro.mall.tiny.controller;

import com.macro.mall.tiny.common.api.CommonResult;
import com.macro.mall.tiny.common.util.JwtTokenUtil;
import com.macro.mall.tiny.mbg.model.OmsOrder;

import com.macro.mall.tiny.service.OmsPortalOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：czx
 * @date ：Created in 2021/7/20 18:09
 * @descriptioin: 订单管理模块
 * @modified By：
 */
@Controller
@RequestMapping("/order")
@Api(tags = "OmsPortalOrderController",description = "订单管理")
@Slf4j
public class OmsPortalOrderController {
    @Autowired
    private OmsPortalOrderService omsPortalOrderService;

   private static final Logger LOGGER = LoggerFactory.getLogger(OmsPortalOrderController.class);
    @ApiOperation("自动取消超时订单")
    @RequestMapping(value = "/cancelTimeOutOrder",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult cancelTimeOutOrder(){
        Integer counts = omsPortalOrderService.cancelTimeOutOrder();
        LOGGER.info("超时的订单有:{}",counts);
        return CommonResult.success(null);
    }


}
